/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package server;

/**
 *
 * @author spider391Tang
 */
import java.net.*;
import java.io.*;
import java.util.*;

class move extends ChatFormat implements BroadcastMsg {

    public move(String line) {

        super(line);

    }

    public void sendMsg(PrintWriter out, KKMultiServerThread server) {
        String name = server.getUser();
        server.send_move_client(out, msg);

    }

    public void execute(KKMultiServerThread server) {

        String[] names = msg.split(" ");
        /// 公子乖 -　
        // names[0] => yoyo-1
        // names[1] => x
        // names[2] => y

        // /obj yoyo chat.CircleBean 369 175 #ff0000 #00ff00 30
        String org = server.getWbMsgQueue().get(names[0]);
        //System.out.println(org);
        String[] orgnames = org.split(" ");

        String newmsg = "";
        newmsg= orgnames[0] + " " + names[1] + " " +  names[2];

        for (int i = 3; i < orgnames.length; i++) {
            newmsg = newmsg.concat(" " + orgnames[i]);
        }
        //System.out.println(newmsg);
        server.getWbMsgQueue().remove(names[0]);
        server.getWbMsgQueue().put(names[0], newmsg);
        server.broadcast(this);
    }
}

